// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WebPartPropertiesInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the WebPartPropertiesInfo
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Web.UI.WebControls.WebParts;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    using Utils;

    [Serializable]
    [CollaborisClass(
        Title = "Web Part Property Information",
        ReleaseStatus = ReleaseStatus.Development,
        Summary = "Defines a set of parameters for a SharePoint web part." 
        )
    ]
    public class WebPartPropertiesInfo : WSSEntityBase
    {
        private string webPartID;
        private string webPartPageRelativeUrl;
        private PersonalizationScope personalizationScope;
        private SerializableObjectDictionary<string> properties;

        [CollaborisProperty(
            Summary = "Specifies the relative URL of the page in the web.",
            Title = "WebPart Page Relative Url",
            Example = @"Pages/Default.aspx",
            InputHint = InputHint.SingleText,
            Required = true)]
        public string WebPartPageRelativeUrl
        {
            get
            {
                return this.webPartPageRelativeUrl;
            }
            set
            {
                this.webPartPageRelativeUrl = value;
            }
        }

        [Obsolete("Please use 'WebPartPageRelativeUrl' instead")]
        public string PageName
        {
            get
            {
                return this.webPartPageRelativeUrl;
            }
            set
            {
                this.webPartPageRelativeUrl = value;
            }
        }

        [CollaborisProperty(
            Summary = "Identifies the webpart in a page.",
            Title = "WebPart Unique ID",
            Example = @"g_576c41f8_fa61_4752_bec9_8eadc99d8ef0",
            InputHint = InputHint.SingleText,
            Required = true)]
        public string WebPartID
        {
            get
            {
                return webPartID;
            }
            set
            {
                webPartID = value;
            }
        }

        [CollaborisProperty(
            Summary = "Indicates the PersonalizationScope for a WebPartManager " +
                    "object or the PersonalizationScope that applies to a " +
                    "property on a web parts control.",
            Title = "Personalization Scope",
            Example = @"Shared",
            InputHint = InputHint.Enum,
            Required = true)]
        public PersonalizationScope PersonalizationScope
        {
            get
            {
                return this.personalizationScope;
            }
            set
            {
                this.personalizationScope = value;
            }
        }

        [CollaborisProperty(
            Summary = "WebPart property value collection.",
            Title = "WebPart properties",
            Example =            @"<dictionary> 
                                    <entry key=""HelpUrl"" value=""http://www.yoursite.com/help"" />                                    
                                  </dictionary>",
            SerializedExample = @"<Dictionary type=""Collaboris.Utils.SerializableObjectDictionary`1[[System.String]]"">
					                <item type=""System.String"">
						                <key>
							                <string>HelpUrl</string>
						                </key>
						                <value>
							                <string>http://www.yoursite.com/help</string>
						                </value>
					                </item>
				                </Dictionary>",
            InputHint = InputHint.ObjectCollection,
            Required = true)]
        public SerializableObjectDictionary<string> Properties
        {
            get
            {
                return properties;
            }
            set
            {
                properties = value;
            }
        }
    }
}   